#include <iostream>
#include <pthread.h>
#include <unistd.h>

void* newThreadRun(void* n)
{
    while(true)
    {
        std::cout << "I am newThread, count: " << (*(int*)(n))++ << std::endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    int count = 0;
    pthread_create(&tid, nullptr, newThreadRun, (void*)(&count));

    while(count < 10)
    {
        std::cout << "I am main Thread, count is lower than 10" << std::endl;
        sleep(1);
    }
}

